<template>
  <table class="table-striped lh-2" :cell-bordered="false" :content-bordered="false">
    <thead>
    <tr>
      <th>期号</th>
      <th>开奖号码</th>
    </tr>
    </thead>
    <tbody>
    <tr v-for="item in data">
      <td>{{item.lotteryNo}}期</td>
      <td class="tips spacing" v-html="stringify(item.results)"></td>
    </tr>
    </tbody>
  </table>
</template>

<script>

export default {
  props: ['history'],
  name: 'history',
  methods: {
    stringify (results) {
      if (!results) {
        return '<b>等待开奖</b>'
      }
      var split = results.split('|')
      return `<b>${split[0].split(',').join(' ')}</b><a class="ml-4">${split[1].split(',').join(' ')}</a>`
    }
  },
  computed: {
    data () {
      return this.history.slice().reverse()
    }
  }
}
</script>

